﻿using UnityEngine;
using System.Collections;

public class timer : MonoBehaviour {

	public float countdown = 0f;
	public float length = 10f;

	public Main main;

	public bool pause;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {

		if (pause == false) {
						transform.eulerAngles = new Vector3 (transform.eulerAngles.x, transform.eulerAngles.y, -(countdown += Time.deltaTime / length) * 360);
						if (countdown > 1f) {
				audio.Play ();
				pause = true;
				main.compare();
				main.nextDrink ();
						}
				}
	}

	public void resetTimer()
	{
		countdown = 0;
		if (pause==true) {
			pause=false;
				}

	}
	
}
